package cn.edu.ctbu.demo2.repository;

import cn.edu.ctbu.demo2.domain.Teacher;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface TeacherReporsitory extends JpaRepository<Teacher,Integer> {

    //按名字查询
    List<Teacher> findByNameLike(String name);

    List<Teacher> findByNameAndPassword (String name,String password);

    /**
     * 按学号查找学生
     * @param
     * @return
     */
    @Query(nativeQuery = true,value = "select * from tb_taecher s where s.no like :no")
    List<Teacher> findBySno(@Param("no") String no);
}
